//
//  UIView+Extension.swift
//  ydy_weibo
//
//  Created by 杨德勇 on 16/7/17.
//  Copyright © 2016年 杨德勇. All rights reserved.
//

import UIKit

extension UIView{
    //通过响应链条取到navigationcontroller
    func navController() -> UINavigationController? {
        let next = self.nextResponder()
        repeat {
            if next is UINavigationController {
                return next as?UINavigationController
            }
        }while (next != nil)
    
        return nil
    }
    
}